﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.IO;

namespace GameProject.Converters
{
    class BuildingToImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is String)
            {
                if (File.Exists(@"Images\Civ_Icons\civ_city\" + (((String)value).ToLower().Replace(" ","") + ".jpg")))
                    return @"Images\Civ_Icons\civ_city\" + (((String)value).ToLower().Replace(" ","")) + ".jpg";
            }
            return @"Images\Civ_Icons\civ_nations\unknown.jpg";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
